import React, {Component} from 'react'
import axios from 'axios'

class App extends Component {
  
  constructor(){
    console.log('dom挂载')
    super()
    this.state = {
      count: 1
    }
  }

  async componentDidMount(){
    const {data} = await axios.get("/api/getJoke?page=1&count=2&type=video")
    console.log(data)
  }

  render () {
    console.log('render函数执行了')
    return (
      <div className="App">
       {this.state.count}
       <button onClick={()=>{this.setState({count: this.state.count + 1})}}>点击</button>
      </div>
    );
  }

  componentDidUpdate () {
    console.log('更新完成')
  }
}

export default App;
